import  request  from '@/utils/request';
//引入数据类型
import type {categoryResponseData} from './model/attr'

enum API {
    C1="/admin/product/getCategory1";
    C2="/admin/product/getCategory2/";
    C3="/admin/product/getCategory3/";
    ATTR="/admin/product/attrInfoList/";
    ADDORUPDATEATTR='/admin/product/saveAttrInfo';
    DELETEATTR="/admin/product/deleteAttr/";
}

// 获取一级分类的请求
export const reqC1List = ()=>request.get<any,categoryResponseData>(API.C1)

//获取二级分类的请求
export const reqC2List = (category1Id:number|string)=>request.get<any,categoryResponseData>(API.C2+category1Id)

//获取三级分类的请求
export const reqC3List = (category2Id:number|string)=>request.get<any,categoryResponseData>(API.C3+category2Id)

//获取三级分类下的平台属性
export const reqAttrList = (category1Id:number|string,category2Id:number|string,category3Id:number|string)=>request.get(API.ATTR+`${category1Id}/${category2Id}/${category3Id}`)

//添加/修改属性的接口
export const reqAddOrUpdateAttr = (data:any)=>request.post(API.ADDORUPDATEATTR,data)

//删除属性接口
export const  reqDeleteAttr = (attrId:number)=>request.delete<any,any>(API.DELETEATTR+attrId)